package cn.rongdao.jrkabao.ui.deposit.adapter;

import android.content.Context;
import android.view.ViewGroup;

import com.mifengkong.frtools.inputmethod.FRView;
import com.mifengkong.frtools.ui.adapter.recyclerview.FRBaseRecyclerAdapter;

import cn.rongdao.jrkabao.R;
import cn.rongdao.jrkabao.bean.deposit.SelectCollectionCardBean;

/**
 * Created by jack on 2018/1/22
 */

public class DepositManagerAdapter extends FRBaseRecyclerAdapter<SelectCollectionCardBean, DepositManagerViewHolder> {

    public DepositManagerAdapter(Context context, OnItemClickListener<DepositManagerViewHolder> listener) {
        super(context, listener);
    }

    @Override
    public DepositManagerViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        return new DepositManagerViewHolder(FRView.inflateLayout(getContext(), R.layout.item_credit, parent, false));
    }

    public void setSelect(int pos) {
        for (int i = 0; i < getDataList().size(); i++) {
            getDataList().get(i).setSelected(false);
            if (i == pos) {
                getDataList().get(pos).setSelected(true);
            }
        }
        notifyDataSetChanged();
    }
}